Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

farmerdoug

macrumors 6502a
Original poster
Sep 16, 2008
541
0
I looked for a way to add a switch to Xcode compile instructions but couldn't find out if it could be done. Can it? How?
 
Where do I add this.

"-arch i386" ?

Instead of shooting the younger trespassers, you might want to consider selling them.

thanks
 
found it.
both i386 and x86_64 are there. My problem may lie else where.
Thanks
 
found it.
both i386 and x86_64 are there. My problem may lie else where.
Thanks

What is your problem?

A guess based on what you have said suggests that you are trying to link against a library which not compiled for a specific architecture. Because it appears that you are compiling your app for i386 and x86_64 you need all the libraries that the app links against to built for the same architectures as well.

Of course I might be wrong as you haven't said anything at all but its a hunch.
 
In another post, I talked about not being able to link my cfitsio (an external) lib in Xcode. NASA suggested the flags which it turns out are already there.
 
In another post, I talked about not being able to link my cfitsio (an external) lib in Xcode. NASA suggested the flags which it turns out are already there.

It sounds exactly like the problem I mentioned above then. You have built the library as either i386 or x86_64 but not both and are building your application for both targets resulting in a compile error.
 
I tried eliminating onne then the other, it didn't help. Here is what my makefile uses.


CC = gcc
CFLAGS = -Wall -g
IDIR = /cfitsio/include
LIBS = -lm
CFITSIOLIB = /cfitsio/lib/libcfitsio.a
 
What is that makefile for? Is it for the cfitsio library, or for the program that uses the cfitsio library?


Does your Xcode project perform a build using a makefile, or does it build using Xcode's builtin rules?

An Xcode project that's built using a makefile will not use anything from Target Settings.


I have no clear sense of what tool (Xcode, make) you're using to build each of your components. If you could clarify which component is being built with what tool, it might help others to help you. Otherwise all anyone can do is guess at what you're doing.
 
Here is an example of a make file that I use.

Code:
CC = gcc
CFLAGS = -Wall  -g 
IDIR = /cfitsio/include
LIBS = -lm
CFITSIOLIB = /cfitsio/lib/libcfitsio.a
OBJS = matrix.o

clean:
		rm -f ${OBJS} ${EXECS}

EXECS	= 	getline2

OBJS	= 	getline2.o 

getline2:	getline2.c
		${CC} -DMAIN ${CFLAGS}  -I${IDIR}  p1640.h  getline2.c  ${CFITSIOLIB}  ${LIBS}  -o getline2

all:		${EXECS} ${OBJS}

I have no idea what Xcode uses. It compiles but does not link the library. The make file does.
 
switches in Xcode

Where would switches like these -DMEMWATCH -NMEMWATHCH_STUDIO be put in Xcode?
Thanks.
 
Well, what have you tried? I'm not on my Mac right now so can't look at the available options but iirc it's pretty obvious. 2 seconds with Google suggests that "Other C Flags" might be a good starting place...
 
Do you mean OTHER_CODE_SIGN_FLAGS =
I was looking for CFlags but didn't find it.
Will try.
 
Do you mean OTHER_CODE_SIGN_FLAGS =
I was looking for CFlags but didn't find it.
Will try.

No. Given the name I would guess that OTHER_CODE_SIGN_FLAGS is for code signing. Which is not what you are doing.

As I said: I'm not on a Mac and don't have access to XCode right now. Did you try reading the XCode documentation? I'm pretty sure it covers this. Also did you search on Google before asking this? If so what did you search for?

Edit: OTHER_CFLAGS is in the Build Settings List You may have to add it as a user-defined setting:

add_build_settings.png
 
To be honest, I don't remember. I may have a few days ago. I find the Xcode documentation very difficult to find anything in. Sometimes its just easier to ask someone who knows.
 
To be honest, I don't remember. I may have a few days ago. I find the Xcode documentation very difficult to find anything in. Sometimes its just easier to ask someone who knows.

I don't know this: I found all this out using a very small amount of time and Google.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.